1. Field of the Invention
The present invention relates to multipliers, and more particularly to a multiplier that can carry out numeric calculation at high speed for computer graphics technique used for three dimensional graphics.
2. Description of the Related Art
Development in computer graphic techniques has become significant in accordance with increase in the high performance of computers. Computer graphics is a technique that is needed to achieve visualization of various scientific technical calculations and virtual reality. Numeric operation processing of extremely high speed is required for such realization.
In computer graphics, an image of high quality is obtained taking advantage of various shading methods such as a ray tracing method tracking all rays on a screen, a Gouraud shading method, and a Phong shading method. In all these methods, the following calculation is carried out to determine the luminance of various points of an object during the calculation process. ##EQU1## where I is the luminance of light at a point of an object, Ii is the luminance value of an incident ray thereat, and Xi is a coefficient value depending upon the angle of a ray, the distance from a light source, reflectance, and transmittance. In general, luminance value Ii is represented by an integer value, and coefficient Xi is calculated by floating-point data for improving the calculation accuracy. Therefore, multiplication of an integer and floating-point data is required in order to carry out the calculation of equation (1). However, there is conventionally no hardware that has the functions to directly carry out this calculation. A method set forth in the following was carried out.
FIG. 8 is a function block diagram of a case where a conventional multiplication of an integer and floating-point data is carried out. Here, the data length is 32 bits. Referring to FIG. 8, luminance value data 1 represented by an integer of 32 bits is applied to a multiply unit 5. Luminance value data 1 is formed of data each of 8 bits including the three primary colors (R: red, G: green, B: blue) and .alpha. representing the transparency. Although transparency data .alpha. is used in addition to the general three primary colors here, the additional data is not limited to transparency as long as the luminance value data includes the three primary colors.
A coefficient 2 expressed by floating-point data is applied as the other data into multiply unit 5. Here, coefficient 2 is a 32-bit single precision floating-point data conforming to the IEEE standard. More specifically, the most significant bit is a code bit, the next 8 bits are the exponent part, and the lower 23 bits are the mantissa. Coefficient 2 is applied to a fixed-point data unit 3 where the floating-point data is converted into fixed-point data. As a result, fixed-point data 4 consisting of an integer part and a fractional part of a fixed bit length is obtained. This fixed-point data 4 is applied to multiply unit 5 to be multiplied by luminance value data 1. The multiplied result of multiply unit 5 is provided to a format conversion unit 6 to be converted into the format of luminance data. Eventually, luminance value data 7 is obtained.
Fixed-point unit 3 obtains fixed-point data 4 by shifting the mantissa according to the value of the exponent part with respect to floating-point data 2. Multiply unit 5 multiplies each of the four data elements of luminance value data 1 by fixed-point data 4 individually. Format conversion unit 6 extracts and aligns every 8 digit figures of the integer part of the multiplied result from multiply unit 5. Traditionally, there is no dedicated hardware for each of the components of the above-described fixed-point unit 3, multiply unit 5, and format conversion unit 6. The above operation was carried out mainly by software by means of a general purpose operation unit such as an ALU and a multiplier. Such calculation required the operation of extracting and processing individually each byte of the data in addition to shifting or merging operations. There was the problem that the calculation operation was time consuming since so many processing steps had to be carried out.
Dedicated hardwares for multiply unit 5 and format conversion unit 6 have been provided for the purpose of improving the above-described problem. Such an example is disclosed in, for example, "Graphics Processing with the 88119 RISC MICROPROCESSOR", digest of papers, COMPCON '92, pp. 169-174, 1992. According to this document, the function is realized by enabling usage of instructions of punpk, pmul and ppack.
FIG. 9 is a diagram for describing a method of achieving this function disclosed in the same document. Referring to (A), the 32-bit data including transparency data .alpha., R data, G data and B data each of 8 bits is extended to a 64-bit data by an instruction "punpk". By multiplying 8-bit data of Ax by "pmul", multiplication of each luminance value can be realized as shown in (B). Furthermore, each most significant 8 bits of the extended data can be extracted to be converted into the format of the luminance data of 32 bits by a ppack instruction.
The dedicated hardware of the above structure provided for improving the conventional problems encountered in a software process has the advantage of allowing parallel multiplication of four luminance elements such as the general three primary colors plus an additional element such as transparency with a multiplier of 64 bits. There is also an advantage that the time required for calculation can be reduced. However, data conversion of coefficient 2 which is floating-point data into fixed-point data 4 is required. Furthermore, a plurality of calculation steps is required to carry out execution of instructions such as ppack and punpk. Therefore, there was still the problem that the calculation operation is time consuming.